<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${mapperPkg}.${entityName}Mapper">

    <resultMap id="BaseResultMap" type="${entityPkg}.${entityName}">
        <#list columnEntityList as filed>
            <#if primaryKey!='noPrimaryKey'&& filed.sqlField==primaryKey>
                <id column="${filed.sqlField}" jdbcType="${filed.columnJdbcType}" property="${filed.fieldNameLow}" />
            <#else>
                <result column="${filed.sqlField}" jdbcType="${filed.columnJdbcType}" property="${filed.fieldNameLow}" />
            </#if>
        </#list>
    </resultMap>

    <sql id="Base_Column_List" >
        <#list columnEntityList as filed>${filed.sqlField}<#sep>,</#sep></#list>
    </sql>

    <!-- 示例-->
    <select id="selectPageList" parameterType="${entityPkg}.${entityName}" resultType="${entityPkg}.${entityName}">
        SELECT
        <include refid="Base_Column_List" />
        from ${prefix}${tableName}
        <where>
        <#list columnEntityList as filed>
            <#if filed.sqlFieldDataType?index_of("char")!=-1 >
                <if test="record.${filed.fieldNameLow}!= null and record.${filed.fieldNameLow}!='' ">
                    ${filed.sqlField} = ${r'#'}{record.${filed.fieldNameLow}}
                </if>
            <#else>
                <if test="record.${filed.fieldNameLow}!= null">
                    ${filed.sqlField} = ${r'#'}{record.${filed.fieldNameLow}}
                </if>
            </#if>
        </#list>
        </where>
    </select>
</mapper>